import axios from '@/utils/axios';

export const getActivityViewPage = (params) => {
    return axios.request({
        url: '/market/activity-view/page',
        method: 'get',
        params
    });
};

export const getActivityViewDetail = (siteId, viewId) => {
    return axios.request({
        url: '/market/activity-view/' + siteId + '/' + viewId,
        method: 'get'
    });
};

export const deleteActivityView = (siteId, viewId) => {
    return axios.request({
        url: '/market/activity-view/' + siteId + '/' + viewId,
        method: 'delete'
    });
};

export const publishActivityView = (siteId, viewId) => {
    return axios.request({
        url: '/market/activity-view/' + siteId + '/' + viewId + '/publish',
        method: 'put'
    });
};

export const pauseActivityView = (siteId, viewId) => {
    return axios.request({
        url: '/market/activity-view/' + siteId + '/' + viewId + '/pause',
        method: 'put'
    });
};

export const recoverActivityView = (siteId, viewId) => {
    return axios.request({
        url: '/market/activity-view/' + siteId + '/' + viewId + '/recover',
        method: 'put'
    });
};

export const editActivityView = (data) => {
    return axios.request({
        url: '/market/activity-view/' + data.id,
        method: 'put',
        data
    });
};

export const addActivityView = (data) => {
    return axios.request({
        url: '/market/activity-view/',
        method: 'post',
        data
    });
};

// 弹出公告页面获取优惠码清单
export const getActivityViewCouponCodeList = (params) => {
    return axios.request({
        url: '/market/coupon/activity-view/code/list',
        method: 'get',
        params
    });
};

// 获取站点当前未结束的优惠码清单(忽略数量限制)
export const getCouponCodeList = (params) => {
    return axios.request({
        url: '/market/coupon/activity-view/code/listForRecallEmail',
        method: 'get',
        params
    });
};
